package com.huaju.enity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * UserRole entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "user_role", catalog = "licai")
@JsonIgnoreProperties(value={"roleType"})
public class UserRole implements java.io.Serializable {

	// Fields

	private Integer roleId;
	private RoleType roleType;
	private SubMenu subMenu;

	// Constructors

	/** default constructor */
	public UserRole() {
	}

	/** full constructor */
	public UserRole(RoleType roleType, SubMenu subMenu) {
		this.roleType = roleType;
		this.subMenu = subMenu;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "role_id", unique = true, nullable = false)
	public Integer getRoleId() {
		return this.roleId;
	}

	public void setRoleId(Integer roleId) {
		this.roleId = roleId;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "role_type_id")
	public RoleType getRoleType() {
		return this.roleType;
	}

	public void setRoleType(RoleType roleType) {
		this.roleType = roleType;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "sub_menu_id")
	public SubMenu getSubMenu() {
		return this.subMenu;
	}

	public void setSubMenu(SubMenu subMenu) {
		this.subMenu = subMenu;
	}

}